 package CurtainDesign;

 import ShapeXmlbean.ShapeType;
 import ShapeXmlbean.ShapesDocument;
 import ShapeXmlbean.ShapesDocument.Factory;
 import ShapeXmlbean.ShapesDocument.Shapes;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Hashtable;
 import javax.swing.JOptionPane;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;

 public class Constants
 {
   public static final int WIND_WIDTH = 820;
   public static final int WIND_HEIGHT = 600;
   public static final int LEFT_WIND_WIDTH = 150;
   public static final String WORKING_PATH = new File("").getAbsolutePath();
   public static final int IMG_WIDTH = 50;
   public static final int IMG_HEIGHT = 30;
   public static final String PIC_PATH = WORKING_PATH + "/data/photo";

   public static final String PIPE_PATH = WORKING_PATH + "/data/pipe";

   public static final String SHAPE_PATH = WORKING_PATH + "/data/shape";

   public static final String SHAPEXMLFILE = WORKING_PATH + "/data/shape.xml";

   public static final String SHAPEBYFOLDXMLFILE = WORKING_PATH + "/data/shapeByFold.xml";

   public static final String LICENSEXMLFILE = WORKING_PATH + "/data/license.xml";

   public static final String CONFIGXMLFILE = WORKING_PATH + "/data/config.xml";

   public static final String[] TODO = { "Select", "Info", "Calculate", "Print", "PrintShippingMark", "Open" };

   public static final String[] WINDOWTYPE = { "方形", "异形" };

   public static final String[] STYLES = { "普通方形", "折叠形", "滑轨形", "TIER ON TIER", "滑道形" };

   public static final String[] STYLES_EN = { "full_height", "byfold", "bypass", "TIER ON TIER", "" };
   public static final int MAXPANELNUM = 12;
   public static final String[] FRAMETYPE = { "大Z", "中Z", "MAZ", "单槽Z", "L型", "芝加哥", "亚特兰大平框", "亚特兰大Z框", "C型平框", "C型Z框", "双面抽条L框", "大Z抽条框", "小Z抽条框", "中Z抽条框", "单槽Z抽条框" };

   public static final String[] FRAMETYPE_EN = { "large_z_frame", "medium_z_frame", "malibu_z_frame", "single_beaded_z_frame", "l_frame", "chicago_frame", "atlanta_flat_frame", "atlanta_z_frame", "howe_case_flat", "howe_case", "l_frame_with_insert", "large_z_frame_with_insert", "small_z_frame_with_insert", "medium_z_frame_with_insert", "beaded_z_frame_wtih_insert" };

   public static final float[] FRAME_BRIM_SIZE = { 57.150002F, 44.450001F, 27.17F, 19.049999F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 57.150002F, 12.75F, 44.450001F, 19.049999F };

   public static final String[] FRAMEWIDTHNUM = { "0", "1", "2" };

   public static final String[] FRAMEHEIGHTNUM = { "0", "1", "2" };
   public static final int MAXPOLENUM = 24;
   public static final int MAXDUIKOUPOLENUM = 24;
   public static final int MAXSHUANGLIANPOLENUM = 24;
   public static final int MAXTPOLENUM = 11;
   public static final String[] VANETYPE = { "63.50", "88.90", "114.30", "48.00", "31.00" };

   public static final String[] BEAMTYPE = { "101.60", "127.00", "152.40" };

   public static final String[] DIVIDERTYPE = { "76.20", "80", "101.60", "75" };
   public static final int MAXDIVIDERNUM = 3;
   public static final String[] PULLBARTYPE = { "普通拉杆Center", "隐式拉杆Hidden", "侧偏拉杆Side" };

   public static final String[] PULLBARTYPE_EN = { "standard", "hidden", "all_offset" };

   public static final String[] CLIENTREGION = { "英国", "澳大利亚" };

   public static final String[] CLIENTREGION_EN = { "U.K", "australia" };
   public static final int MAXSINGLEHINGE = 12;
   public static final int MAXDOUBLEHINGE = 12;
   public static final int MAXBENDLEHINGE = 12;
   public static final String[] COLOR = { "PR 底漆", "RA 原色", "WH101", "WH102", "WH103", "WH104", "WH105", "WH106", "WH107", "WH108", "WH109", "WH110", "WH111", "WH112", "WH113", "WH114", "WH115", "WH116", "WH117", "WH118", "WH119", "WH120", "H134", "H140", "H016", "H148", "H043", "G145", "ST205", "ST206", "ST212", "ST305", "ST309", "ST310", "ST312", "ST313", "ST401", "ST402", "ST403", "ST404", "ST405", "ST406", "ST407", "ST501", "ST502", "ST503", "ST504", "ST505", "ST506", "ST507", "ST601", "ST602", "ST603", "ST604", "ST605", "ST606" };

   public static final String[] COLOR_EN = { "PR", "RA", "WH101", "WH102", "WH103", "WH104", "WH105", "WH106", "WH107", "WH108", "WH109", "WH110", "WH111", "WH112", "WH113", "WH114", "WH115", "WH116", "WH117", "WH118", "WH119", "WH120", "H134", "H140", "H016", "H148", "H043", "G145", "ST205", "ST206", "ST212", "ST305", "ST309", "ST310", "ST312", "ST313", "ST401", "ST402", "ST403", "ST404", "ST405", "ST406", "ST407", "ST501", "ST502", "ST503", "ST504", "ST505", "ST506", "ST507", "ST601", "ST602", "ST603", "ST604", "ST605", "ST606" };

   public static final String[] COLOR_SHIPPINGMARK = { "Prime Base", "Row Wood", "Pure White", "Snow White", "Bright White", "Ultra White", "Ivory Pearl", "Milk White", "Soft Linen", "Colonial White", "Antique White", "Cream", "Egg Shell", "Cotton White", "Lvory", "Alabaster", "Ice Whtte", "Beach", "Navajo", "Marzipan", "Butter", "Warm Sun", "H134", "H140", "H016", "H148", "H043", "G145", "ST205", "ST206", "ST212", "ST305", "ST309", "ST310", "ST312", "ST313", "Red Buttons", "Red Sycamore", "Cherrywood", "Rich Mahogany", "Autumn Red Wood", "Dd Chianti", "Burgundy", "Limestone", "Honey Oak", "Fruitwood", "Old Hickory", "Walnut", "Avalon", "Chocolate", "Harvest Gold", "Avalon", "Wheat", "Autumn Spice", "Bart", "Merlot" };

   public static final String[] HINGECOLOR = { "亮白BW", "灰白OW", "暗白DW", "镀金BS", "镀银NI", "不锈钢SS", "暗铜AB", "青铜OB" };

   public static final String[] HINGECOLOR_EN = { "bright_white", "off_white", "dull_white", "brass", "nickle", "stainless_steel", "antique_brass", "oil_brass" };

   public static final String[] WOODOPTION = { "WOOD WHOLE PIECE底漆独条", "WOOD WHOLE PIECE PLAIN素板", "PRE-PRIMED 指接拉膜", "WITH PRIMER 指接上底漆", "FINGER JOINT 指接染色" };

   public static final String[] WOODOPTION_EN = { "wood_whole_piece_with_primer", "wood_whole_piece_with_plain", "pre-primed_wood_finger_jointed_with_primer", "wood_finger_jointed_with_primer", "wood_finger_jointed_with_plain" };

   public static final String[] FRAMENUMPOS = { "四框，不切底", "四框，切底", "无框", "无下框", "无上框", "左框高", "右框高", "无上下框" };

   public static final String[] FRAMENUMPOS_EN = { "4_sides", "4_sides_but cut_ bottom", "no_frame", "3_sides_without_bottom", "3_sides_without_top", "only_left_frame", "only_right_frame", "left_side_and_right_side" };

   public static final String[] INSTALL = { "里WOD", "外OD" };

   public static final String[] INSTALL_EN = { "WOD", "OD" };

   public static final String[] TRACK_NUM = { "2", "3", "4" };

   public static final String[][] FRAMECODE = { { "WD1ZF", "WDSZF", "WD2ZF", "WD3ZF", "WD4ZF" }, { "WD1MZF", "WDSMZF", "WD2MZF", "WD3MZF", "WD4MZF" }, { "WD1MF", "WDSMF", "WD2MF", "WD3MF", "WD4MF" }, { "WD1SBZF", "WDSSBZF", "WD2SBZF", "WD3SBZF", "WD4SBZF" }, { "WD1LF", "WDSLF", "WD2LF", "W3LF", "WD4LF" }, { "WD1CHICAGOZF", "WDSCHICAGOZF", "WD2CHICAGOZF", "WD3CHICAGOZF", "WD4CHICAGOZF" }, { "WD1ATLFLAT", "WDSATLFLAT", "WD2ATLFLAT", "WD3ATLFLAT", "WD4ATLFLAT" }, { "WD1ATLZF", "WDSATLZF", "WD2ATLZF", "WD3ATLZF", "WD4ATLZF" }, { "WD1HCFLAT", "WDSHCFLAT", "WD2HCFLAT", "WD3HCFLAT", "WD4HCFLAT" }, { "WD1HCF", "WDSHF", "WD2HF", "WD3HCF", "WD4HCF" }, { "WD1CLF", "WDSCLF", "WD2CLF", "WD3CLF", "WD4CLF" }, { "WD1CLZF", "WDSCLZF", "WD2CLZF", "WD3CLZF", "WDCLZF" }, { "WD1CSZF", "WDSCSZF", "WDSCSZF", "WD3CSZF", "WD4CSZF" }, { "WD1CMZF", "WDSCMZF", "WD2CMZF", "WD3CMZF", "WD4CMZF" }, { "WD1CBZF", "WDSCBZF", "WD2CBZF", "WD3CBZF", "WD4CBZF" } };

   public static final String[][] STILECODE = { { "WD1SR", "WDSSR", "WD2SR", "WD3SR", "WD4SR" }, { "WD1S", "WDSS", "WD2S", "WD3S", "WD4S" }, { "WD1SSR", "WDSSSR", "WD2SSR", "WD3SSR", "WD4SSR" } };

   public static final String[][] BEAMCODE = { { "WD1R101.6", "WDSR101.6", "WD2R101.6", "WD3R101.6", "WD4R101.6" }, { "WD1R127", "WDSR127", "WD2R127", "WD3R127", "WD4R127" }, { "WD1R152.4", "WDSR152.4", "WD2R152.4", "WD3R152.4", "WD4R152.4" } };

   public static final String[][] DIVIDERBEAMCODE = { { "WD1DR76.2", "WDSDR76.2", "WD2DR76.2", "WD3DR76.2", "WD4DR76.2" }, { "WD1DR80", "WDSDR80", "WD2DR80", "WD3DR80", "WD4DR80" }, { "WD1DR101.6", "WDSDR101.6", "WD2DR101.6", "WD3DR101.6", "WD4DR101.6" }, { "WD1DR75", "WDSDR75", "WD2DR75", "WD3DR75", "WD4DR75" } };

   public static final String[][] VANECODE = { { "WD163.5L", "WDS63.5L", "WD263.5L", "WD363.5L", "WD463.5L" }, { "WD189L", "WDS89L", "WD289L", "WD389L", "WD489L" }, { "WD1114L", "WDS114L", "WD2114L", "WD3114L", "WD4114L" }, { "WD148L", "WDS48L", "WD248L", "WD348L", "WD448L" }, { "WD131L", "WDS31L", "WD231L", "WD331L", "WD431L" } };

   public static final String[] PULLBAR = { "WD1TR", "WDSTR", "WD2TR", "WD3TR", "WD4TR" };

   public static final String[] TPULLBAR = { "WD1TP", "WDSTP", "WD2TP", "WD3TP", "WD4TP" };

   public static final String[] SLIM_TPOLE_CODE = { "WD1BTP", "WDSBTP", "WD2BTP", "WD3BTP", "WD4BTP" };

   public static final String[] CT_TPOLE_CODE = { "WD1CTP", "WDSCTP", "WD2CTP", "WD13CTP", "WD4CTP" };

   public static final String[] TPOLE_CODE = { "WDICTP", "WDIBTP", "WDITP", "" };

   public static final String[] LIGHTBLOCK = { "WD1LIGHTBLOCK", "WDSLIGHTBLOCK", "WD2LIGHTBLOCK", "WD3LIGHTBLOCK", "WD4LIGHTBLOCK" };

   public static final String[] LZLACE = { "WD1ZTRIML", "WDSZTRIML", "WD2ZTRIML", "WD3ZTRIML", "WD4ZTRIML" };

   public static final String[] MZLACE = { "WD1ZTRIMM", "WDSZTRIMM", "WD2ZTRIMM", "WD3ZTRIMM", "WD4ZTRIMM" };

   public static final String[] LLACE = { "WD1LTRIM", "WDSLTRIM", "WD2LTRIM", "WD3LTRIM", "WD4LTRIM" };

   public static final String[] ALUMBAR = { "HIDDENROD50.8", "HIDDENROD76.2", "HIDDENROD101.6", "HIDDENROD40", "" };
   public static final String TENON_CODE = "WDDOWEL";
   public static final String[] PCMAG = { "PCMAG", "PCMAGROUND" };
   public static final String PC1PIN = "PC1PIN";
   public static final String[] HINGECODE = { "WD1RAHINGE", "WD1HINGE", "WD1HINGEBUTT" };
   public static final String BOARDCODE = "BOARD";
   public static final String MAGNETSLICECODE = "MAGNETSLICE";
   public static final String DOUBLEPLASTERCODE = "DOUBLEPLASTER";
   public static final String COMMENT_DIVIDER = "@@";
   public static final int MAX_PIPEINDEX = 3;
   public static final int[] TABLESIZE = { 10, 4 };
   public static final int MAX_WINDOWNUM = 100;
   public static final float MAX_BEAM_WIDTH = 810.0F;
   public static final float MIN_BEAM_WIDTH = 130.0F;
   public static final String[][] FRAME_FOUR_INSIDE = { { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" } };

   public static final String[][] FRAME_FOUR_INSIDE_QIEDI = { { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "50.8", "50.8" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" }, { "38.1", "38.1" } };

   public static final String[][] FRAME_THREE_INSIDE = { { "38.1", "19.05" }, { "38.1", "19.05" }, { "38.1", "19.05" }, { "38.1", "19.05" }, { "50.8", "25.4" }, { "50.8", "25.4" }, { "50.8", "25.4" }, { "50.8", "25.4" }, { "50.8", "25.4" }, { "50.8", "25.4" }, { "50.8", "25.4" }, { "38.1", "19.05" }, { "38.1", "19.05" }, { "38.1", "19.05" }, { "38.1", "19.05" } };

   public static final String[][] FRAME_ONE_INSIDE = { { "19.05", "0" }, { "19.05", "0" }, { "19.05", "0" }, { "19.05", "0" }, { "25.4", "0" }, { "25.4", "0" }, { "25.4", "0" }, { "25.4", "0" }, { "25.4", "0" }, { "25.4", "0" }, { "25.4", "0" }, { "19.05", "0" }, { "19.05", "0" }, { "19.05", "0" }, { "19.05", "0" } };

   public static final String[][] FRAME_TWO_INSIDE = { { "0", "19.05" }, { "0", "19.05" }, { "0", "19.05" }, { "0", "19.05" }, { "0", "25.4" }, { "0", "25.4" }, { "0", "25.4" }, { "0", "25.4" }, { "0", "25.4" }, { "0", "25.4" }, { "0", "25.4" }, { "0", "19.05" }, { "0", "19.05" }, { "0", "19.05" }, { "0", "19.05" } };

   public static final String[] TRACK = { "PC1WAYTRACK", "PC2WAYTRACK" };

   public static final String[] FASCIA = { "WDZTRIMM", "WDLTRIM", "WDZTRIMM" };
   public static final String PIVOT_KIT = "PCPIVOT";
   public static final String ROLLER = "PCROLLER";
   public static final String[] STATUS = { "NORMAL", "EXPIRED" };

   public static final Hashtable m_HashHinging = new Hashtable();

   public static String[] HINGE_TYPES = null;

   public static String[] BYFOLD_HINGE_TYPES = null;

   public static final Hashtable m_HashByFoldHinging = new Hashtable();

   public static final Hashtable m_HashConfig = new Hashtable();

   public static String picInstancePath = "/Users/72cy-0101-01-0009/Documents/picInstance.jpg";
   public static final String ENCKEY = "VERSION3.0";
   public static final String[] MAGNET_TYPE = { "圆磁碰", "方磁碰" };

   public static final String[] T_POLE_TYPE = { "抽条厚T型立杆", "薄T型立杆", "普通T立杆", "无" };

   public static final String[] T_POLE_TYPE_EN = { "with_insert", "thin", "normal", "none" };
   public static final float T_POLE_WIDTH = 25.4F;
   public static String sysUser = "";

   public static String sysPwd = "";

   public static final String[] SHIPINGITEM = { "窗FRAMES AND HARDWARES", "扇PANELS", "其他" };

   public static final String ACROBAT_PATH = new String("");

   public static void InitConfig()
   {
     try
     {
       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       DocumentBuilder db = dbf.newDocumentBuilder();

       Document doc = db.parse(new File(CONFIGXMLFILE));
       NodeList adobe = doc.getElementsByTagName("Adobe");
       if ((adobe != null) && (adobe.item(0) != null) && (adobe.item(0).hasChildNodes())) {
         String a = adobe.item(0).getFirstChild().getNodeValue();
         m_HashConfig.put("Adobe", a);
       }
       NodeList userNode = doc.getElementsByTagName("User");
       if ((userNode != null) && (userNode.item(0) != null) && (userNode.item(0).hasChildNodes())) {
         sysUser = userNode.item(0).getFirstChild().getNodeValue();
       }
       NodeList pwdNode = doc.getElementsByTagName("PWD");
       if ((pwdNode != null) && (pwdNode.item(0) != null) && (pwdNode.item(0).hasChildNodes()))
         sysPwd = pwdNode.item(0).getFirstChild().getNodeValue();
     }
     catch (Exception e)
     {
       e.printStackTrace();
     }
   }

   public static void InitHinging()
   {
     try
     {
       File xmlfile = new File(SHAPEXMLFILE);
       ShapesDocument doc = ShapesDocument.Factory.parse(xmlfile);
       ShapeType[] shapes = doc.getShapes().getShapeArray();

       String hingeInstall = "";
       HINGE_TYPES = new String[shapes.length];
       for (int i = 0; i < shapes.length; i++) {
         if (shapes[i].getDetail() != null) {
           hingeInstall = shapes[i].getDetail() + ":";
         }
         else {
           JOptionPane.showMessageDialog(null, "第(i+1)个窗户的description有误", "错误", 0);
         }

         if (shapes[i].getDescription() != null) {
           hingeInstall = hingeInstall + shapes[i].getDescription();
           m_HashHinging.put(shapes[i].getDescription(), hingeInstall);
           HINGE_TYPES[i] = hingeInstall;
         }
         else {
           JOptionPane.showMessageDialog(null, "第(i+1)个窗户的description有误", "错误", 0);
         }
       }

     }
     catch (Exception e)
     {
       e.printStackTrace();
     }
   }

   public static void InitByFoldHinging()
   {
     try {
       File xmlfile = new File(SHAPEBYFOLDXMLFILE);
       ShapesDocument doc = ShapesDocument.Factory.parse(xmlfile);
       ShapeType[] shapes = doc.getShapes().getShapeArray();

       String hingeInstall = "";
       BYFOLD_HINGE_TYPES = new String[shapes.length];
       for (int i = 0; i < shapes.length; i++) {
         if (shapes[i].getDetail() != null) {
           hingeInstall = shapes[i].getDetail() + ":";
         }
         else {
           JOptionPane.showMessageDialog(null, "第(i+1)个窗户的description有误", "错误", 0);
         }

         if (shapes[i].getDescription() != null) {
           hingeInstall = hingeInstall + shapes[i].getDescription();
           m_HashByFoldHinging.put(shapes[i].getDescription(), hingeInstall);
           BYFOLD_HINGE_TYPES[i] = hingeInstall;
         }
         else {
           JOptionPane.showMessageDialog(null, "第(i+1)个窗户的description有误", "错误", 0);
         }
       }
     }
     catch (Exception e) {
       e.printStackTrace();
     }
   }

   public static boolean GetParaFromHingeInstall(String hingeInstall, String windowType)
   {
     int totalPanel = 0; int hingePanelNum = 0; int doubleHingePanelNum = 0; int poleBarNum = 0; int duikouPoleBarNum = 0; int tPoleBarNum = 0;
     float gap = 0.0F;
     ArrayList hingeArray = GetDesFromHingeInstall(hingeInstall);
     if (windowType.equalsIgnoreCase("Normal"))
     {
       String nextDesc;
       for (int i = 0; i < hingeArray.size(); i++) {
         String desc = (String)hingeArray.get(i);
         if (desc.equalsIgnoreCase("T")) {
           tPoleBarNum++;
         }
         else {
           int num = Integer.parseInt(desc.substring(0, 1));
           totalPanel += num;
           gap += 1.59F;
           if (i == hingeArray.size() - 1) {
             if (num == 1) {
               gap += 3.17F;
               break;
             }

             gap += 1.59F;

             break;
           }

           nextDesc = (String)hingeArray.get(i + 1);
         }

       }

     }

     return true;
   }

   public static ArrayList GetDesFromHingeInstall(String hingeInstallType)
   {
     ArrayList hingeArray = new ArrayList();
     int oldHingeTypeLength = hingeInstallType.length();
     for (int i = 0; (i < hingeInstallType.length()) &&
       (hingeInstallType.length() >= 2); i++)
     {
       String strTmp1 = hingeInstallType.substring(0, 2);
       hingeArray.add(strTmp1);
       if (hingeInstallType.length() == 2) {
         break;
       }
       String strTmp2 = hingeInstallType.substring(2, 3);
       if (strTmp2.equalsIgnoreCase("T")) {
         hingeArray.add(strTmp2);
         hingeInstallType = hingeInstallType.substring(3);
       }
       else
       {
         hingeInstallType = hingeInstallType.substring(2);
       }
     }

     return hingeArray;
   }
 }

/* Location:           C:/Users/Administrator/Desktop/奥特百叶窗/Shutter DesignerV3.1/CurtainDesign.jar
 * Qualified Name:     CurtainDesign.Constants
 * JD-Core Version:    0.6.0
 */